/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ar.edu.utn.frsf.cidisi.bbp.impl;

import ar.edu.utn.frsf.cidisi.bbp.BbpFactory;
import ar.edu.utn.frsf.cidisi.bbp.BbpPackage;
import ar.edu.utn.frsf.cidisi.bbp.ClosingConstruct;
import ar.edu.utn.frsf.cidisi.bbp.Node;
import ar.edu.utn.frsf.cidisi.bbp.OpeningConstruct;
import ar.edu.utn.frsf.cidisi.bbp.Tree;

import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;

import org.eclipse.emf.ecore.impl.EPackageImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Package</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class BbpPackageImpl extends EPackageImpl implements BbpPackage {
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass treeEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass nodeEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EEnum openingConstructEEnum = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EEnum closingConstructEEnum = null;

	/**
	 * Creates an instance of the model <b>Package</b>, registered with
	 * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
	 * package URI value.
	 * <p>Note: the correct way to create the package is via the static
	 * factory method {@link #init init()}, which also performs
	 * initialization of the package, or returns the registered package,
	 * if one already exists.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see org.eclipse.emf.ecore.EPackage.Registry
	 * @see ar.edu.utn.frsf.cidisi.bbp.BbpPackage#eNS_URI
	 * @see #init()
	 * @generated
	 */
	private BbpPackageImpl() {
		super(eNS_URI, BbpFactory.eINSTANCE);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private static boolean isInited = false;

	/**
	 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
	 * 
	 * <p>This method is used to initialize {@link BbpPackage#eINSTANCE} when that field is accessed.
	 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #eNS_URI
	 * @see #createPackageContents()
	 * @see #initializePackageContents()
	 * @generated
	 */
	public static BbpPackage init() {
		if (isInited) return (BbpPackage)EPackage.Registry.INSTANCE.getEPackage(BbpPackage.eNS_URI);

		// Obtain or create and register package
		BbpPackageImpl theBbpPackage = (BbpPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof BbpPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new BbpPackageImpl());

		isInited = true;

		// Create package meta-data objects
		theBbpPackage.createPackageContents();

		// Initialize created meta-data
		theBbpPackage.initializePackageContents();

		// Mark meta-data to indicate it can't be changed
		theBbpPackage.freeze();

  
		// Update the registry and return the package
		EPackage.Registry.INSTANCE.put(BbpPackage.eNS_URI, theBbpPackage);
		return theBbpPackage;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getTree() {
		return treeEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getTree_Name() {
		return (EAttribute)treeEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getTree_Root() {
		return (EReference)treeEClass.getEStructuralFeatures().get(1);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getNode() {
		return nodeEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getNode_Children() {
		return (EReference)nodeEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getNode_Id() {
		return (EAttribute)nodeEClass.getEStructuralFeatures().get(1);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getNode_OpeningSemantics() {
		return (EAttribute)nodeEClass.getEStructuralFeatures().get(2);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getNode_ClosingSemantics() {
		return (EAttribute)nodeEClass.getEStructuralFeatures().get(3);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EEnum getOpeningConstruct() {
		return openingConstructEEnum;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EEnum getClosingConstruct() {
		return closingConstructEEnum;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BbpFactory getBbpFactory() {
		return (BbpFactory)getEFactoryInstance();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isCreated = false;

	/**
	 * Creates the meta-model objects for the package.  This method is
	 * guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void createPackageContents() {
		if (isCreated) return;
		isCreated = true;

		// Create classes and their features
		treeEClass = createEClass(TREE);
		createEAttribute(treeEClass, TREE__NAME);
		createEReference(treeEClass, TREE__ROOT);

		nodeEClass = createEClass(NODE);
		createEReference(nodeEClass, NODE__CHILDREN);
		createEAttribute(nodeEClass, NODE__ID);
		createEAttribute(nodeEClass, NODE__OPENING_SEMANTICS);
		createEAttribute(nodeEClass, NODE__CLOSING_SEMANTICS);

		// Create enums
		openingConstructEEnum = createEEnum(OPENING_CONSTRUCT);
		closingConstructEEnum = createEEnum(CLOSING_CONSTRUCT);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isInitialized = false;

	/**
	 * Complete the initialization of the package and its meta-model.  This
	 * method is guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void initializePackageContents() {
		if (isInitialized) return;
		isInitialized = true;

		// Initialize package
		setName(eNAME);
		setNsPrefix(eNS_PREFIX);
		setNsURI(eNS_URI);

		// Create type parameters

		// Set bounds for type parameters

		// Add supertypes to classes

		// Initialize classes and features; add operations and parameters
		initEClass(treeEClass, Tree.class, "Tree", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEAttribute(getTree_Name(), ecorePackage.getEString(), "name", null, 0, 1, Tree.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEReference(getTree_Root(), this.getNode(), null, "root", null, 0, 1, Tree.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		initEClass(nodeEClass, Node.class, "Node", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEReference(getNode_Children(), this.getNode(), null, "children", null, 0, -1, Node.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEAttribute(getNode_Id(), ecorePackage.getEString(), "id", null, 0, 1, Node.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEAttribute(getNode_OpeningSemantics(), this.getOpeningConstruct(), "openingSemantics", null, 0, 1, Node.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEAttribute(getNode_ClosingSemantics(), this.getClosingConstruct(), "closingSemantics", null, 0, 1, Node.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		// Initialize enums and add enum literals
		initEEnum(openingConstructEEnum, OpeningConstruct.class, "OpeningConstruct");
		addEEnumLiteral(openingConstructEEnum, OpeningConstruct.AND);
		addEEnumLiteral(openingConstructEEnum, OpeningConstruct.XOR);
		addEEnumLiteral(openingConstructEEnum, OpeningConstruct.OR);
		addEEnumLiteral(openingConstructEEnum, OpeningConstruct.LOOP_WHILE);
		addEEnumLiteral(openingConstructEEnum, OpeningConstruct.LOOP_UNTIL);
		addEEnumLiteral(openingConstructEEnum, OpeningConstruct.CANCEL);
		addEEnumLiteral(openingConstructEEnum, OpeningConstruct.SEQUENCE);
		addEEnumLiteral(openingConstructEEnum, OpeningConstruct.TERMINATION);

		initEEnum(closingConstructEEnum, ClosingConstruct.class, "ClosingConstruct");
		addEEnumLiteral(closingConstructEEnum, ClosingConstruct.EMPTY);
		addEEnumLiteral(closingConstructEEnum, ClosingConstruct.AND);
		addEEnumLiteral(closingConstructEEnum, ClosingConstruct.XOR);
		addEEnumLiteral(closingConstructEEnum, ClosingConstruct.SYNC_MERGE);

		// Create resource
		createResource(eNS_URI);
	}

} //BbpPackageImpl
